<?php
/**
 * 作者：亿泽
 * QQ：1260435972
 * 交流群：557649112
 * 日期：2022/03/31
 * 项目名称：亿泽不用验证系统
 * 项目说明：请勿进行违法用途，当您在使用本项目中的任何源代码时默认同意作者的观点！
 * 观点：
 * 1.禁止将本系统使用于违法违规用途。
 * 2.禁止将本系统使用包含但不限于 灰色产业/进行灰色产业的机器人插件/框架。
 * 3.禁止进行商业性质的二创二开，仅授权免费个人使用
 * 4.本系统为免费/全开源项目，禁止进行任何商业活动 除非 获得作者授权！
 * 感谢：
 * 1.使用了 光年 后台模板
 * 2.参考了 网络上部分代码资料
 * 3.感谢各位的使用~
 **/
require_once "../include/common.php";
require_once "header.php";
$title = '版本管理列表 - 亿泽不用验证后台管理系统';
if ($islogin == 1) {
} else exit("<script>window.location.href='./login.html';</script>");
?>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar d-flex flex-column flex-md-row">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" href="ver_add.php"><i class="mdi mdi-plus"></i> 新增</a>
                        <a class="btn btn-success m-r-5 ajax-post confirm" href="#!"
                           target-form="ids"><i class="mdi mdi-check"></i> 启用</a>
                        <a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
                        <a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>
                    </div>

                    <form class="search-bar ml-md-auto" method="get" action="#!" role="form">
                        <input type="hidden" name="search_field" id="search-field" value="title"/>
                        <div class="input-group ml-md-auto">
                            <div class="input-group-prepend">
                                <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"
                                        aria-haspopup="true" aria-expanded="false" id="search-btn">标题
                                </button>
                                <div class="dropdown-menu" style="">
                                    <a class="dropdown-item" href="#!" data-field="title">标题</a>
                                    <a class="dropdown-item" href="#!" data-field="cat_name">栏目</a>
                                </div>
                            </div>
                            <input type="text" class="form-control" name="keyword" placeholder="请输入名称">
                        </div>
                    </form>
                </div>
                <div class="card-body">

                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>
                                    <div class="custom-control custom-checkbox">
                                        <input type="checkbox" class="custom-control-input" id="check-all">
                                        <label class="custom-control-label" for="check-all"></label>
                                    </div>
                                </th>
                                <th>应用ID</th>
                                <th>应用名称</th>
                                <th>版本号</th>
                                <th>应用版本</th>
                                <th>模式</th>
                                <th>更新日期</th>
                                <th>人数</th>
                                <th>到期时间</th>
                                <th>身份验证</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php
                            $re = Db ::table ('applist as t1,appver') -> rawfind ("SELECT t2.id,t2.bd_appid,t1.name, t2.version, t2.title, t2.subtitle,t2.vername, t2.free, t2.update, t2.log, t2.download, t2.affiche, t2.expire, t2.auth, t2.enable FROM yz_applist as t1,yz_appver as t2 WHERE t1.appid=t2.bd_appid order by 'bd_appid';");
                            $i = 1;
                            while ($res = $re -> fetch ()) {
                                $id = $res['id'];
                                $appid = $res['bd_appid'];
                                $appname = $res['name'];
                                $appver = $res['version'];
                                $title = $res['title'];
                                $subtitle = $res['subtitle'];
                                $vername = appver_name_op($res['vername'],1);
                                $free = appver_mod_op($res['free']);
                                $update = $res['update'];
                                $log = $res['log'];
                                $download = $res['download'];
                                $affiche = $res['affiche'];
                                $expire = $res['expire'];
                                $auth = appver_auth_op($res['auth']);
                                $enable = app_state_op ($res['enable']);

                                //获取 现行时间戳
                                $time = time () - $interval;
                                //在线人数
                                $onlinenum = Db ::table ('online') -> countnum ("times >='$time' and appid='$appid' and appver='$appver'");
                                //使用过的人数
                                $usenum = Db ::table ('online') -> countnum ("appid='$appid' and appver='$appver'");

                                $s2 = '<div class="btn-group">
                                        <a class="btn btn-xs btn-default" href="./ver_edit.php?my=upstate&id='. $id .'&appid=' . $appid . '" title="" data-toggle="tooltip"
                                           data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
                                        <a class="btn btn-xs btn-default" href="./ver_edit.php?my=del&id='. $id .'&appid=' . $appid . '" title="" data-toggle="tooltip"
                                           data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                                    </div>';
                                echo '<tr>
                                            <td>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input ids" name="ids[]" value="' . $i . '" id="ids-' . $i . '">
                      <label class="custom-control-label" for="ids-' . $i . '"></label>' . $i . '
                    </div></td>
											<td>' . $appid . '</td>
											<td><span class="badge badge-info"><i class="mdi mdi-spin mdi-star"></i>&nbsp;' . $appname . '</span></td>
											<td><span class="badge badge-info-light">V' . $appver . '</span></td>
											<td>' . $vername . '</td>
											<td>' . $free . '</td>
											<td>' . $update . '</td>
											<td><span class="badge badge-cyan"><i class="mdi mdi-account-star"></i> ' . $onlinenum . ' / ' . $usenum . '</span></td>
											<td>' . date("Y-m-d H:i",$expire) . '</td>
											<td>' . $auth . '</td>
											<td>' . $enable . '</td>
											<td>' . $s2 . '</td></tr>';
                                $i++;
                            }
                            ?>
                            </tbody>
                        </table>
                    </div>
                    <ul class="pagination">
                        <li class="page-item disabled"><span class="page-link">上一页</span></li>
                        <li class="page-item active"><span class="page-link">1</span></li>
                        <li class="page-item"><a class="page-link" href="#1">2</a></li>
                        <li class="page-item disabled"><span class="page-link">...</span></li>
                        <li class="page-item"><a class="page-link" href="#!">10</a></li>
                        <li class="page-item"><a class="page-link" href="#!">下一页</a></li>
                    </ul>

                </div>
            </div>
        </div>

    </div>

</div>

